﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace Aproll
{
	public class BaseLineFilter : ISelectionFilter
	{
		public BaseLineFilter(bool includeTempLine = false)
		{
			this.m_IncludeTempLine = includeTempLine;
		}

		public bool AllowElement(Element elem)
		{
			if (typeof(DetailLine) != elem.GetType() && typeof(DetailArc) != elem.GetType())
			{
				return false;
			}
			DetailCurve detailCurve = elem as DetailCurve;
			return detailCurve != null && (detailCurve.LineStyle.Name.CompareTo("AprollBaseLine") == 0 || detailCurve.LineStyle.Name.CompareTo("TempLine") == 0);
		}

		public bool AllowReference(Reference reference, XYZ pos)
		{
			return false;
		}

		private bool m_IncludeTempLine;
	}
}
